<template>
	<view class="drugClass-wrap">
		<view class="category-wrapper">
			<!-- 左边导航 -->
			<scroll-view show-scrollbar="false" class=" left-wrapper" scroll-y>
				<view class="left-content">
					<view class="title-content" :class="selectKs === item.code ? 'onSelected' : ''" v-for="(item, index) in ksList" :key="index" @click="chooseClass(item.code)">
						{{ item.departmentName }}疾病
					</view>
				</view>
			</scroll-view>

			<!-- 右边内容 -->
			<!-- <scroll-view show-scrollbar="false" class="right-wrapper" :scroll-y="true" @scrolltolower="goodsScroll()" :scroll-with-animation="true" :scroll-top="scrollTop" @scroll="scroll"> -->
			<scroll-view show-scrollbar="false" class="right-wrapper" scroll-y>
				<view class="right-content">
					<view class="product-wrapper">
						<view class="category-item" id="list">
							<view class="category-item-info" v-for="(item, index) in sicknessList" :key="index" @click="gotoRouter('/pages-doctor/drugList/drugList')">
								{{ item.sicknessName }}
							</view>
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
const app = getApp();
export default {
	data() {
		return {
			sicknessList: [], //数据列表
			ksList: [
				// {
				// 	code: "",
				// 	departmentName: '全部'
				// }
			], //科室列表
			selectKs: '10030', //选择的科室
		};
	},
	onLoad(option) {

		this.queryKsList();
		this.querySicknessPage()
	},
	onShow() {},
	methods: {
		//分类选择
		chooseClass(code) {
			if (this.selectKs === code) {
				return;
			} 
			this.selectKs = code;
			this.querySicknessPage()
		},

		//科室列表
		queryKsList() {
			this.$api.queryKsList({}).then(res => {
				if (res.code == 200) {
					this.ksList = this.ksList.concat(res.result);
				} else {
					uni.showToast({
						title: res.message,
						icon: 'none'
					});
				}
			});
		},


		//疾病分页
		querySicknessPage() {
			this.$api.querySicknessPage({
				params:{
					pageNo:1,
					pageSize:999,
					sicknessDepartmentCode:this.selectKs
				}
			}).then(res => {
				if (res.code == 200) {
					this.sicknessList = res.result.records;
				} else {
					uni.showToast({
						title: res.message,
						icon: 'none'
					});
				}
			});
		},


		
		//数据滚动
		goodsScroll() {}
	}
};
</script>

<style lang="less">
@import './drugClass.less';
</style>
